import java.util.HashMap;

public class IgoChessmanFactory {
    public HashMap<String, IgoChessman> igoChessmanHashMap = new HashMap<String,IgoChessman>();
    public IgoChessman getIgoChessman(String key) {
        IgoChessman igoChessman;
        if (igoChessmanHashMap.containsKey(key)) {
            igoChessman = igoChessmanHashMap.get(key);
        }
        else if(key.equals("黑色")){
            igoChessman=new BlacklgoChessman();
            igoChessmanHashMap.put(key, igoChessman);
        }
        else{
            igoChessman=new WhitelgoChessman();
            igoChessmanHashMap.put(key, igoChessman);
        }
        return igoChessman;
    }
}
